﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BitFactory.Logging;

namespace P.InOut.NetMvc.Common
{
    /// <summary>
    /// Custom logger class that logs to a database
    /// </summary>
    public abstract class AbstractDatabaseLogger : Logger
    {
        /// <summary>
        /// Application inserting log event
        /// </summary>
        private string _application;
        public string Application
        {
            get { return _application; }
            set { _application = value; }
        }

        private string _connection;
        public string Connection
        {
            get { return _connection; }
            set { _connection = value; }
        }

        /// <summary>
        /// Empty constructor
        /// </summary>
        public AbstractDatabaseLogger() { }

        /// <summary>
        /// Constructor that sets Properties
        /// </summary>
        /// <param name="appName">Application Name</param>
        /// <param name="conn">Database Connection String</param>
        public AbstractDatabaseLogger(string appName, string conn)
        {
            //  Set properties
            Application = appName;
            Connection = conn;
        }

        public abstract bool Execute(string application, string category, 
            string message, DateTime datetime, LogSeverity severity);
    }
}
